import request from '../utils/request'

export const activityApi = {
  /**获取活动分类列表 */
  getActivityClassify(): Promise<ActivityClassify> {
    return request.get('/event-categories')
  },
  /** 获取指定条件下的活动列表 */
  getActivityList(params: GetActivityListParams): Promise<Activity[]> {
    return request.get('/events', { params })
  },
  /** 创建活动 */
  creatActivity(payload: PostActivity) {
    return request.post('/events', payload)
  },
  /** 编辑活动 */
  editorActivity(id: number, payload: PostActivity) {
    return request.patch(`/events/${id}`, payload)
  },
  /** 查询某个活动详情 */
  getActivity(id: number): Promise<Activity> {
    return request.get(`/events/${id}`)
  },
  /** 查询某个活动详情 */
  getActivityDetail(id: number): Promise<ActivityPriceDetail[]> {
    return request.get(`/events/getMatchTicketPrice?event_id=${id}`)
  },
  /** 对活动感兴趣 */
  insterestActivity(id: number) {
    return request.post(`/events/${id}/interest`)
  },
  /** 对活动取消感兴趣 */
  deleteInsterestActivity(id: number) {
    return request.delete(`/events/${id}/interest`)
  },
  /** 想加入活动 */
  wantJoinActivity(id: number) {
    return request.post(`/events/${id}/want-join`)
  },
  /** 获取活动的点评 */
  getActivityComments(id: number): Promise<DomoFeed[]> {
    return request.get(`/events/${id}/comments`)
  },
  /** 删除活动 */
  DeleteActivity(id: number) {
    return request.delete(`/events/${id}`)
  },
  /** 获取想要参加的活动列表 */
  getWantJoinList(params: GetWantJoinParams): Promise<[]> {
    return request.get('/events/want-join-logs', { params })
  },
  /** 获取感兴趣的活动列表 */
  getLikedList(params: GetWantJoinParams): Promise<[]> {
    return request.get('/events/interested-logs', { params })
  },
}
